import java.util.Random;

public class test7 {
    public static void main(String[] args) throws InterruptedException {
Thread t1=new Thread(()->{
    Random random=new Random();
    while (true){
        int time= random.nextInt(10);
        System.out.println(Thread.currentThread().getName());
        try {
            Thread.sleep(time*100);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
},"t1");
t1.start();

Random random=new Random();
while (true){
    int time= random.nextInt(10);
    System.out.println(Thread.currentThread().getName());
    Thread.sleep(time*100);

}
    }
}
